export const debounce = (fn: Function, delay = 300) => {
  let timer: number | null = null
  return (...args: any[]) => {
    // 如果已有定时器存在，先清除定时器
    timer && clearTimeout(timer)
    timer = setTimeout(() => fn(...args), delay)
  }
}
